<template>
	<view class="">
		<image :src="$_BASE_IMG_API+'/images/mineEnterImage.png'" style="width: 750rpx;" mode="widthFix"></image>
		<view class="flex flex-column align-center">
			<text class="u-m-t-30 u-font-30 font-weight-bold">入驻流程</text>
			<text class="u-m-t-40 font-weight-bold">第一步</text>
			<text class="u-m-t-10">查看入驻协议</text>
			<text class="u-m-t-40 font-weight-bold">第二步</text>
			<text class="u-m-t-10">填写商家信息</text>
			<text class="u-m-t-40 font-weight-bold">第三步</text>
			<text class="u-m-t-10">平台审核资质</text>
			<text class="u-m-t-40 font-weight-bold">第四步</text>
			<text class="u-m-t-10">审核通过，成功入驻</text>
		</view>
		<view class="flex flex-column align-center justify-center u-m-t-40">
			<dy-button width="576rpx" size="default" v-if="merch_apply_switch==0" disabled>暂不支持入驻</dy-button>
			<dy-button width="576rpx" size="default" v-if="merch_apply_switch == 1 && !log" @click="toNext(0)">企业商户入驻</dy-button>
			<dy-button class="u-m-t-30 x_wei" width="576rpx" size="default" v-if="merch_apply_switch == 1 && !log" @click="toNext(1)">个人商户入驻</dy-button>
			<dy-button width="576rpx" size="default" v-if="merch_apply_switch == 1 && log" @click="toApplyDetail">{{status_text}}</dy-button>
		</view>
	</view>
</template>

<script>
	// import { mineApi } from '@/api/myAjax.js' 
	import { MineCenterApi } from '@/api/serves.js' 
	export default {
		data() {
			return {
				agreement_switch: '',    // 入驻协议开关
				merch_apply_switch: '',  // 入驻开关
				status_text: '',         // 申请状态
				log: null,               // 上一次的商户入住申请记录
				refusetext:'',
			}
		},
		onShow() {
			this._applyIndex()
		},
		methods: {
			_applyIndex() {
				uni.showLoading()
				MineCenterApi.applyIndex().then(res => {
				  console.log('入驻配置信息', res);
					uni.hideLoading()
					if(res.code == 1){
						this.agreement_switch  = res.data.merch_in_agreement_switch
						this.merch_apply_switch  = res.data.merch_apply_switch
						if(res.data.log){
							this.log = res.data.log
							this.status_text = res.data.log.status_text
							this.refusetext = res.data.log.reason
						}
					}
				})
			},
			toNext(type) {
				//type  1 企业商户入驻   2 小微商户入驻
				console.log(type);
				uni.navigateTo({
					url: '/pages/mine/mineEnterPages/mineEnterAgreement/mineEnterAgreement?type=' + type
				})
			},
			toApplyDetail() {
				uni.navigateTo({
					url: '/pages/mine/mineEnterPages/mineEnterResult/mineEnterResult?type=detail'
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
.x_wei{
	::v-deep .u-btn{
		// color: #333 !important;
		// background-color: rgba(254,87,42,0.8) !important;
		// border-color:rgba(254,87,42,0.8) !important;
	}
}
</style>
